# Maintainer: Masanori Shirayama <mashir43@gmail.com>

pkgname=tcsh
pkgver=6.19.00
pkgrel=1
epoch=
pkgdesc="C shell with file name completion and command line editing"
arch=("i686" "x86_64")
url="http://www.tcsh.org/"
license=('BSD')
groups=()
depends=('gcc-libs' 'libcatgets' 'libcrypt' 'libiconv' 'ncurses')
makedepends=('gcc' 'libcatgets-devel' 'libcrypt-devel' 'libiconv-devel' 'ncurses-devel')
provides=('csh')
conflicts=('csh')
install=tcsh.install
source=("ftp://ftp.astron.com/pub/$pkgname/$pkgname-$pkgver.tar.gz"
        "msys-platform.patch")
sha256sums=('12e271e0b89e4259d9d6e8d525322e77340e7244cfbd199a591e5f8146285c49'
            '69d1f10818adf9ebb09369a5eb3500c289f518c5e54f51d93439c7a6ac90af6b')

prepare() {
  cd "${srcdir}/$pkgname-$pkgver"
  cp -f config/cygwin config/msys
  patch -p1 -i ${srcdir}/msys-platform.patch
  autoreconf -ivf
}

build() {
  cd "${srcdir}/$pkgname-$pkgver"
  ./configure \
    --prefix=/usr \
    --build=${CHOST}
  make
}

check() {
  cd "${srcdir}/$pkgname-$pkgver"
  #make -k check
}

package() {
  cd "${srcdir}/$pkgname-$pkgver"
  make DESTDIR="$pkgdir/" install

  install -Dm644 ./Copyright ${pkgdir}/usr/share/licenses/tcsh/Copyright

  cd "${pkgdir}/usr/bin"
  cp -p tcsh.exe csh.exe
}
